package com.huitu.whht.ribbon_customer_feign.Controller;

import com.huitu.whht.base.core.api.wr.ab.entities.WrAbBQo;
import com.huitu.whht.base.core.api.wr.wfz.entities.WrWfzBQo;
import com.huitu.whht.ribbon_customer_feign.Service.HelloSevice;
import com.huitu.whht.ribbon_customer_feign.Service.ISzyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
public class CustomerController {

    @Autowired
    HelloSevice helloSevice;

    @Autowired
    ISzyService szyService;

    @RequestMapping("/helloFeign")
    String customer(){
        return helloSevice.hello();
    }

    @RequestMapping(value = "/getMethodWithParam",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ResponseBody
    Object getMethodWithParam(){
        return szyService.getMethodWithParam("FF000000000L0071");
    }

    @RequestMapping(value = "/postMethod",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ResponseBody
    Object selectList(){
        Map<String, Object> result=(Map<String, Object>)szyService.postMethod();
        System.out.println(result);
        return szyService.postMethod();
    }

    @PostMapping(value = "/postMehodWithParam",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ResponseBody
    Object postMehodWithParamTest(){
        WrAbBQo wrAbBQo=new  WrAbBQo();
        wrAbBQo.setRbCd("FF000000000L0071");

        return szyService.postMehodWithParam(wrAbBQo);
    }

    @PostMapping(value = "/postMehodWithParam2",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ResponseBody
    Map postMehodWithParamTest2(){
        WrWfzBQo wrWfzBQo=new  WrWfzBQo();
        wrWfzBQo.setWfzCd("F1004009213000");
        return szyService.postMehodWithParam2(wrWfzBQo);
    }
}
